<template>
	<view>
		<view class="farm">
			<view class="vlsit_view">
				<image src="https://star.googom.cn/chuangge/jichuxinxi.png" mode="" class="jichuxinxi"></image>
				<view class="shujusdf">
					<view class="touxiang">
						客户头像
					</view>
					<view class="touxiangsd">
						<u-upload width="44" height="44" :fileList="fileList1" @afterRead="afterRead" name="1" multiple
							:maxCount="1" :deletable="false">
							<view class="asosafasdf">
								<view class="avaterss">
									<image :src="imageUrl+avatar" mode="" class="avater" v-if="avatar != ''"></image>
									<image src="@/static/images/avater.png" mode="" class="avater" v-else></image>
								</view>
								<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
							</view>
						</u-upload>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						客户姓名<text>*</text>
					</view>
					<view class="touxiangsd">
						<input type="text" placeholder="请输入姓名" v-model="name" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						客户性别<text>*</text>
					</view>
					<picker @change="bindPickerChanges" :value="hy_index" :range="hy_array">
						<view class="touxiangssd">
							<view class="xuansda" v-if="hy_array[hy_index] == undefined">
								请选择性别
							</view>
							<view class="xuansdas" v-else>
								{{hy_array[hy_index]}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						客户电话<text>*</text>
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入电话" v-model="phone" placeholder-class="onpus"
							class="onpuss" maxlength="11" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						备用电话
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入备用电话" v-model="phones" placeholder-class="onpus"
							class="onpuss" maxlength="11" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						来访时间
					</view>
					<view class="touxiangsd" @click="show = true">
						<view class="onpuss">
							{{dayinfasd}}
						</view>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						客户职业<text>*</text>
					</view>
					<picker @change="bindPickerChange" :value="zy_index" :range="zy_array" range-key="dictLabel">
						<view class="touxiangssd">
							<view class="xuansda" v-if="zy_array[zy_index].dictLabel == undefined">
								请选择职业
							</view>
							<view class="xuansdas" v-else>
								{{zy_array[zy_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						客户年龄<text>*</text>
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入年龄" v-model="age" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
			</view>
			<view class="vlsit_view">
				<image src="https://star.googom.cn/chuangge/kehudengji.png" mode="" class="jichuxinxi"></image>
				<view class="shujusdfs">
					<view class="touxiang">
						客户等级<text>*</text>
					</view>
					<picker @change="bindPickerChangekhdj" :value="khdj_index" :range="khdj_array"
						range-key="dictLabel">
						<view class="touxiangssd" >
							<view class="xuansda" v-if="khdj_array[khdj_index].dictLabel == undefined">
								请选择客户等级
							</view>
							<view class="xuansdas" v-else>
								{{khdj_array[khdj_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
			</view>
			<view class="vlsit_view">
				<image src="https://star.googom.cn/chuangge/jaiitngxinxi.png" mode="" class="jichuxinxi"></image>
				<view :class="area == '' ? 'shujusdfs':'shujusdfss'" @click="getaddresswei()">
					<view class="touxiang">
						居住区域<text>*</text>
					</view>
					<view class="touxiangssd">
						<view class="xuansda" style="width: 362rpx;">
							{{area?area:'请选择居住区域'}}
							
						</view>
						<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						工作区域
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入工作区域" v-model="adddetil" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						家庭结构
					</view>
					<picker @change="bindPickerChangejtjg" :value="jtjg_index" :range="jtjg_array"
						range-key="dictLabel">
						<view class="touxiangssd" >
							<view class="xuansda" v-if="jtjg_array[jtjg_index].dictLabel == undefined">
								请选择家庭结构
							</view>
							<view class="xuansdas" v-else>
								{{jtjg_array[jtjg_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						家庭成员
					</view>
					<picker @change="bindPickerChangecy" :value="cy_index" :range="cy_array" range-key="dictLabel">
						<view class="touxiangssd" >
							<view class="xuansda" v-if="cy_array[cy_index].dictLabel == undefined">
								请选择家庭成员
							</view>
							<view class="xuansdas" v-else>
								{{cy_array[cy_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						居住环境
					</view>
					<picker @change="bindPickerChangejzhj" :value="jzhj_index" :range="jzhj_array"
						range-key="dictLabel">
						<view class="touxiangssd" >
							<view class="xuansda" v-if="jzhj_array[jzhj_index].dictLabel == undefined">
								请选择居住环境
							</view>
							<view class="xuansdas" v-else>
								{{jzhj_array[jzhj_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
			</view>
			<view class="vlsit_view">
				<image src="https://star.googom.cn/chuangge/goufangxinxi.png" mode="" class="jichuxinxi"></image>
				<view class="shujusdfs">
					<view class="touxiang">
						置业经验
					</view>
					<picker @change="bindPickerChangezyjy" :value="zyjy_index" :range="zyjy_array"
						range-key="dictLabel">
						<view class="touxiangssd">
							<view class="xuansda" v-if="zyjy_array[zyjy_index].dictLabel == undefined">
								请选择置业经验
							</view>
							<view class="xuansdas" v-else>
								{{zyjy_array[zyjy_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs" @click="opens()">
					<view class="touxiang">
						意向产品<text>*</text>
					</view>
					<view class="touxiangssd" >
						<view class="xuansda" v-if="chanpin == ''">
							请选择意向产品
						</view>
						<view class="xuansdas" v-if="chanpin != ''">
							{{chanpin}}
						</view>
						<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						意向面积<text>*</text>
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向面积" v-model="yxmj" placeholder-class="onpus"
							class="onpuss" />
							<view class="imfgaf" style="margin-right: 22rpx;">
								m²
							</view>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						意向单价
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向单价" v-model="yxdj" placeholder-class="onpus"
							class="onpuss" />
							<view class="imfgaf">
								元
							</view>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						意向楼层
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向楼层" v-model="yxlc" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<!-- <view class="shujusdfs" @click="openss()">
					<view class="touxiang">
						意向楼号
					</view>
					<view class="touxiangssd" style="width: 311rpx;">
						<view class="xuansda">
							请选择意向楼号
						</view>
					</view>
					<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
				</view>
				<view class="shujusdfs" @click="opensss()">
					<view class="touxiang">
						意向单元
					</view>
					<view class="touxiangssd" style="width: 311rpx;">
						<view class="xuansda">
							请选择意向单元
						</view>
					</view>
					<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
				</view> -->
				<view class="shujusdfs">
					<view class="touxiang">
						意向楼号
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向楼号" v-model="yxlh" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						意向单元
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向单元" v-model="yxdy" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						意向房号
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入意向房号" v-model="yxfh" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						置业目的<text>*</text>
					</view>
					<picker @change="bindPickerChangezymd" :value="zymd_index" :range="zymd_array"
						range-key="dictLabel">
						<view class="touxiangssd">
							<view class="xuansda" v-if="zymd_array[zymd_index].dictLabel == undefined">
								请选择置业目的
							</view>
							<view class="xuansdas" v-else>
								{{zymd_array[zymd_index].dictLabel}}
							</view>
							<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
						</view>
					</picker>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						车位价位
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入车位价位" v-model="cwjw" placeholder-class="onpus"
							class="onpuss" />
							<view class="imfgaf">
								元
							</view>
					</view>
				
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						储藏价位
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入储藏室价位" v-model="cssjw" placeholder-class="onpus"
							class="onpuss" />
							<view class="imfgaf">
								元
							</view>
					</view>
					
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						总价预算
					</view>
					<view class="touxiangsd">
						<input type="number" placeholder="请输入总价预算" v-model="zjys" placeholder-class="onpus"
							class="onpuss" />
							<view class="imfgaf">
								元
							</view>
					</view>
				</view>
				<view class="shujusdfs" @click="openssss()">
					<view class="touxiang">
						关注重点<text>*</text>
					</view>
					<view class="touxiangssd" >
						<view class="xuansda" v-if="guanafafgafaf == ''">
							请选择关注重点
						</view>
						<view class="xuansdas" v-if="guanafafgafaf != ''">
							{{guanafafgafaf}}
						</view>
						<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
					</view>
				</view>
				<view class="shujusdfs" @click="opensssss()">
					<view class="touxiang">
						认知途径<text>*</text>
					</view>
					<view class="touxiangssd">
						<view class="xuansda" v-if="guanafafgafafasda == ''">
							请选择认知途径
						</view>
						<view class="xuansdas" v-if="guanafafgafafasda != ''">
							{{guanafafgafafasda}}
						</view>
						<image src="https://star.googom.cn/chuangge/xialsd.png" mode="" class="xialsd"></image>
					</view>
				</view>
				<view class="shujusdfs">
					<view class="touxiang">
						备注
					</view>
					<view class="touxiangsd">
						<input type="text" placeholder="请输入备注" v-model="beizhu" placeholder-class="onpus"
							class="onpuss" />
					</view>
				</view>
			</view>
			<view class="bolck"></view>
			<view class="good_detil_navigationBar">
				<view class="cgouimai" @click="getcustomers">
					保存
				</view>
			</view>
		</view>
		<!-- 来电时间 -->
		<u-datetime-picker :show="show" v-model="value1" mode="datetime" ref="datetimePicker" @confirm="confirm"
			@close="show=false" :closeOnClickOverlay="true" :closeOnClickAction="true" @cancel="cancel"
			:formatter="formatter" :maxDate="Number(new Date())"></u-datetime-picker>
		<!-- 意向产品 -->
		<u-popup :show="showyx" :round="10" mode="bottom" @close="close" @open="opens" :closeable="true">
			<view class="tipPopup_titless">意向产品</view>
			<view class="yxch_flex">
				<view :class="item.is_skuxz == 1 ?'yix_view':'yix_views' " v-for="(item,index) in yxcp_array"
					:key="index" @click="getyxcp(index)">
					{{item.dictLabel}}
				</view>
			</view>
			<view class="baiocuyn" @click="getyixiangd">
				确定
			</view>
		</u-popup>
		<!-- 意向楼号 -->
		<u-popup :show="showlh" :round="10" mode="bottom" @close="closes" @open="openss" :closeable="true">
			<view class="tipPopup_titless">意向楼号</view>
			<view class="yxch_flex">
				<view :class="yxlh_index == index ?'yix_view':'yix_views' " v-for="(item,index) in yxlh_array"
					:key="index" @click="getyxlh(index)">
					{{item}}
				</view>
			</view>
			<view class="baiocuyn">
				确定
			</view>
		</u-popup>
		<!-- 意向单元 -->
		<u-popup :show="showdy" :round="10" mode="bottom" @close="closess" @open="opensss" :closeable="true">
			<view class="tipPopup_titless">意向单元</view>
			<view class="yxch_flex">
				<view :class="yxdy_index == index ?'yix_view':'yix_views' " v-for="(item,index) in yxdy_array"
					:key="index" @click="getyxdy(index)">
					{{item}}
				</view>
			</view>
			<view class="baiocuyn">
				确定
			</view>
		</u-popup>
		<!-- 关注重点 -->
		<u-popup :show="showzd" :round="10" mode="bottom" @close="closesss" @open="openssss" :closeable="true">
			<view class="tipPopup_titless">关注重点</view>
			<view class="yxch_flex">
				<view :class="item.is_skuxz == 1 ?'yix_view':'yix_views' " v-for="(item,index) in gzzd_array"
					:key="index" @click="getgzzd(index)">
					{{item.dictLabel}}
				</view>
			</view>
			<view class="baiocuyn" @click="guanhfuasf">
				确定
			</view>
		</u-popup>
		<!-- 认知途径 -->
		<u-popup :show="showtj" :round="10" mode="bottom" @close="closessss" @open="opensssss" :closeable="true">
			<view class="tipPopup_titless">认知途径</view>
			<view class="yxch_flex">
				<view :class="item.is_skuxz == 1 ?'yix_view':'yix_views' " v-for="(item,index) in rztj_array"
					:key="index" @click="geteztj(index)">
					{{item.dictLabel}}
				</view>
			</view>
			<view class="baiocuyn" @click="guanhrensdfas()">
				确定
			</view>
		</u-popup>
	</view>
</template>

<script>
	import config from '@/common/config.js'
	import wgs from '@/util/wgs.js';
	export default {
		data() {
			return {
				avatar: '',
				imageUrl: config.configURLs,
				fileList1: [],
				name: '',
				phone: '',
				phones:'',
				age: '',
				adddetil: '',
				yxmj: '',
				yxdj: '',
				yxlc: '',
				yxfh: '',
				cwjw: '',
				cssjw: '',
				zjys: '',
				beizhu: '',
				yxlh: '',
				yxdy: '',
				show: false,
				value1: Number(new Date()),
				dayinfasd: '',
				visible: false,
				showyx: false,
				showlh: false,
				showdy: false,
				showzd: false,
				showtj: false,
				maskCloseAble: true,
				hy_array: ['男', '女'],
				hy_index: -1,
				zy_array: [],
				zy_index: -1,
				khdj_array: [],
				khdj_index: -1,
				jtjg_array: [],
				jtjg_index: -1,
				cy_array: [],
				cy_index: -1,
				jzhj_array: [],
				jzhj_index: -1,
				zyjy_array: [],
				zyjy_index: -1,
				yxcp_array: [],
				chanpin: '',
				yxlh_array: ['A1', 'A2', 'A3', 'A4', 'A5', 'A6', 'A7', 'A8', 'A9'],
				yxlh_index: -1,
				yxdy_array: ['1单元', '2单元', '3单元', '4单元', '5单元', '6单元', '7单元', '8单元', '9单元'],
				yxdy_index: -1,
				zymd_array: [],
				zymd_index: -1,
				gzzd_array: [],
				guanafafgafaf: '',
				rztj_array: [],
				guanafafgafafasda: '',
				area: '', //地区名称
				defaultValue: '',
				projectnameid: 0,
				isClickable: true,
				latitude: 0,
				longitude: 0,
				currentLocation:{}
			}
		},
		onReady() {
			// 微信小程序需要用此写法
			this.$refs.datetimePicker.setFormatter(this.formatter)
		},
		onShow() {
			this.projectnameid = uni.getStorageSync('projectnameid');
			this.getFormattedDate()
			//查询职业
			this.getzhiye()
			//查询客户等级
			this.getkhdj()
			//查询家庭架构
			this.getjtjgs()
			//查询家庭成员
			this.getjtchys()
			//查询居住环境
			this.getjzhjss()
			//查询置业经验
			this.getzyjysd()
			//查询意向产品
			this.getyxvhad()
			//查询置业目的
			this.getzfsafaf()
			//查询关注重点
			this.getgzhudasd()
			//查询认知途径
			this.getrestysd()
		},
		methods: {
			//点击保存
			getcustomers() {
				if (this.isClickable) {
					this.isClickable = false;
					if (this.name == '' || this.name == null) {
						uni.showToast({
							title: '请输入姓名',
							icon: 'none'
						})
					} else if (this.hy_index == -1) {
						uni.showToast({
							title: '请输入性别',
							icon: 'none'
						})
					} else if (this.phone == '' || this.phone == null) {
						uni.showToast({
							title: '请输入电话',
							icon: 'none'
						})
					} else if (!/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/.test(this
							.phone)) {
						uni.showToast({
							title: '手机号格式不正确~',
							icon: 'none'
						})
					} else if (this.zy_index == -1) {
						uni.showToast({
							title: '请选择职业',
							icon: 'none'
						})
					} else if (this.age == '' || this.age == null) {
						uni.showToast({
							title: '请输入年龄',
							icon: 'none'
						})
					} else if (this.khdj_index == -1) {
						uni.showToast({
							title: '请选择客户等级',
							icon: 'none'
						})
					} else if (this.area == '') {
						uni.showToast({
							title: '请选择居住区域',
							icon: 'none'
						})
					} else if (this.chanpin == '') {
						uni.showToast({
							title: '请选择意向产品',
							icon: 'none'
						})
					} else if (this.yxmj == '') {
						uni.showToast({
							title: '请选择意向面积',
							icon: 'none'
						})
					} else if (this.zymd_index == -1) {
						uni.showToast({
							title: '请选择置业目的',
							icon: 'none'
						})
					} else if (this.guanafafgafaf == '') {
						uni.showToast({
							title: '请选择关注重点',
							icon: 'none'
						})
					} else if (this.guanafafgafafasda == '') {
						uni.showToast({
							title: '请选择认知途径',
							icon: 'none'
						})
					} else {
						this.getcustomerss()
					}
					setTimeout(() => {
						this.isClickable = true;
					}, 500);
				} else {
					uni.showToast({
						title: '操作太快了~',
						icon: 'none'
					});
				}
			},
			//点击保存
			async getcustomerss() {
				var that = this
				uni.showLoading({
					title: '加载中',
					mask: true,
				});
				let data = await that.$api.getcustomer({
					projectId: that.projectnameid,
					name: that.name,
					headImg: that.avatar,
					sex: that.hy_index,
					age: that.age,
					phone: that.phone,
					phone1:that.phones,
					visitTime: that.dayinfasd + ':00',
					job: that.zy_array[that.zy_index] == undefined ? '' : that.zy_array[that.zy_index]
						.dictLabel,
					level: that.khdj_array[that.khdj_index] == undefined ? '' : that.khdj_array[that
						.khdj_index].dictLabel,
					residentialArea: that.area,
					workArea: that.adddetil,
					familyStructure: that.jtjg_array[that.jtjg_index] == undefined ? '' : that.jtjg_array[that
						.jtjg_index].dictLabel,
					familyMember: that.cy_array[that.cy_index] == undefined ? '' : that.cy_array[that.cy_index]
						.dictLabel,
					living: that.jzhj_array[that.jzhj_index] == undefined ? '' : that.jzhj_array[that
						.jzhj_index].dictLabel,
					propertyExperience: that.zyjy_array[that.zyjy_index] == undefined ? '' : that.zyjy_array[
						that.zyjy_index].dictLabel,
					intentionalProduct: that.chanpin,
					intentionalArea: that.yxmj,
					intentionalPrice: that.yxdj,
					intentionalTotal: that.zjys,
					intentionalFloor: that.yxlc,
					intentionalBuild: that.yxlh,
					intentionalUnit: that.yxdy,
					intentionalRoom: that.yxfh,
					propertyPurpose: that.zymd_array[that.zymd_index] == undefined ? '' : that.zymd_array[that
						.zymd_index].dictLabel,
					stall: that.cwjw,
					storeroom: that.cssjw,
					focus: that.guanafafgafaf,
					way: that.guanafafgafafasda,
					status: 1,
					aspect: 2,
					situationRemark: that.beizhu
				});
				uni.hideLoading();
				if (data.code == 200) {
					uni.showToast({
						title: '保存成功',
						icon: 'none'
					})
					setTimeout(function() {
						uni.navigateBack()
					}, 1000);
				} else {
					uni.showToast({
						title: data.msg,
						icon: 'none'
					})
				}
			},
			//选择性别
			bindPickerChanges: function(e) {
				this.hy_index = e.detail.value
			},
			//查询职业
			getzhiye() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/job',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.zy_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择职业
			bindPickerChange: function(e) {
				this.zy_index = e.detail.value
			},
			//查询客户等级
			getkhdj() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/crm_level',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.khdj_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择客户等级
			bindPickerChangekhdj: function(e) {
				this.khdj_index = e.detail.value
			},
			//查询家庭架构
			getjtjgs() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/family_structure',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.jtjg_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择家庭架构
			bindPickerChangejtjg: function(e) {
				this.jtjg_index = e.detail.value
			},
			//查询家庭成员
			getjtchys() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/family_member',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.cy_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择家庭成员
			bindPickerChangecy: function(e) {
				this.cy_index = e.detail.value
			},
			//查询居住环境
			getjzhjss() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/living',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.jzhj_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择居住环境
			bindPickerChangejzhj: function(e) {
				this.jzhj_index = e.detail.value
			},
			//查询置业经验
			getzyjysd() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/property_experience',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.zyjy_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择置业经验
			bindPickerChangezyjy: function(e) {
				this.zyjy_index = e.detail.value
			},
			//查询置业目的
			getzfsafaf() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/property_purpose',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							this.zymd_array = res.data.data
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择置业目的
			bindPickerChangezymd: function(e) {
				this.zymd_index = e.detail.value
			},
			//查询意向产品
			getyxvhad() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/intentional_product',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							var xfgsgList = res.data.data
							for (var i = 0; i < xfgsgList.length; i++) {
								xfgsgList[i].is_skuxz = 0
							}
							this.yxcp_array = xfgsgList
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择意向产品
			getyxcp(e) {
				if (this.yxcp_array[e].is_skuxz == 1) {
					this.yxcp_array[e].is_skuxz = 0
				} else {
					this.yxcp_array[e].is_skuxz = 1
				}
				this.chanpin = this.yxcp_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(',');
			},
			//意向产品确定按钮
			getyixiangd() {
				this.showyx = false
				this.chanpin = this.yxcp_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(',');
			},
			//选择意向楼号
			getyxlh(e) {
				this.yxlh_index = e
			},
			//选择意向单元
			getyxdy(e) {
				this.yxdy_index = e
			},
			//查询关注重点
			getgzhudasd() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/focus',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							var xfgsgList = res.data.data
							for (var i = 0; i < xfgsgList.length; i++) {
								xfgsgList[i].is_skuxz = 0
							}
							this.gzzd_array = xfgsgList
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择关注重点
			getgzzd(e) {
				if (this.gzzd_array[e].is_skuxz == 1) {
					this.gzzd_array[e].is_skuxz = 0
				} else {
					this.gzzd_array[e].is_skuxz = 1
				}
				this.guanafafgafaf = this.gzzd_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(
					',');
			},
			//关注重点确定按钮
			guanhfuasf() {
				this.showzd = false
				this.guanafafgafaf = this.gzzd_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(
					',');
			},
			//查询认知途径
			getrestysd() {
				uni.request({
					url: config.configURL + 'system/dict/data/type/way',
					method: 'GET',
					header: {
						'Content-Type': 'application/x-www-form-urlencoded',
						'Authorization': 'Bearer ' + uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code == 200) {
							var xfgsgList = res.data.data
							for (var i = 0; i < xfgsgList.length; i++) {
								xfgsgList[i].is_skuxz = 0
							}
							this.rztj_array = xfgsgList
						} else {
							uni.showToast({
								title: data.msg,
								icon: 'none'
							})
						}
					},
				})
			},
			//选择认知途径
			geteztj(e) {
				this.rztj_array.forEach(item => {
					item.is_skuxz = 0;
				});
				this.rztj_array[e].is_skuxz = 1;
				this.guanafafgafafasda = this.rztj_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(',');
			},
			//认知途径确定按钮
			guanhrensdfas() {
				this.showtj = false
				this.guanafafgafafasda = this.rztj_array.filter(item => item.is_skuxz === 1).map(item => item.dictLabel).join(',');
			},
			//关闭城市列表
			cancels() {
				this.visible = false
			},
			//打开意向产品
			opens() {
				this.showyx = true
			},
			//关闭意向产品
			close() {
				this.showyx = false
			},
			//打开意向楼号
			openss() {
				this.showlh = true
			},
			//关闭意向楼号
			closes() {
				this.showlh = false
			},
			//打开意向单元
			opensss() {
				this.showdy = true
			},
			//关闭意向单元
			closess() {
				this.showdy = false
			},
			//打开关注重点
			openssss() {
				this.showzd = true
			},
			//关闭关注重点
			closesss() {
				this.showzd = false
			},
			//打开认知途径
			opensssss() {
				this.showtj = true
			},
			//关闭认知途径
			closessss() {
				this.showtj = false
			},
			//获取当前时间
			getFormattedDate() {
				const date = new Date()
				const year = date.getFullYear()
				const month = this.formatNumber(date.getMonth() + 1)
				const day = this.formatNumber(date.getDate())
				const hours = this.formatNumber(date.getHours())
				const minutes = this.formatNumber(date.getMinutes())
				this.dayinfasd = `${year}-${month}-${day} ${hours}:${minutes}`
			},
			formatNumber(num) {
				return num < 10 ? `0${num}` : num
			},
			//选择时间
			confirm(e) {
				this.show = false
				this.result(e.value, e.mode)
			},
			cancel() {
				this.show = false
			},
			result(time, mode) {
				const timeFormat = uni.$u.timeFormat
				const data = timeFormat(time, 'yyyy-mm-dd  hh:MM')
				let str = data;
				this.dayinfasd = str
			},
			formatter(type, value) {
				if (type === 'year') {
					return `${value}年`
				}
				if (type === 'month') {
					return `${value}月`
				}
				if (type === 'day') {
					return `${value}日`
				}
				if (type === 'hour') {
					return `${value}时`
				}
				if (type === 'minute') {
					return `${value}分`
				}
				return value
			},
			// 新增图片
			async afterRead(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this[`fileList${event.name}`].length
				lists.map((item) => {
					this[`fileList${event.name}`].push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this[`fileList${event.name}`][fileListLen]
					this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: config.configURL + 'system/user/profile/avatar', // 仅为示例，非真实的接口地址
						filePath: url,
						name: 'avatarfile',
						header: {
							Authorization: 'Bearer ' + uni.getStorageSync('token')
						},
						success: (res) => {
							let res2 = JSON.parse(res.data)
							this.avatar = res2.imgUrl
							setTimeout(() => {
								resolve(res.data.url)
							}, 1000)
						}
					});
				})
			},
			//点击获取详细地址
			getaddresswei() {
				if (this.isClickable) {
					this.isClickable = false;
					uni.getSetting({
						success: (res) => {
							if (res.authSetting['scope.userLocation']) {
								/* 用户授权成功时走这里 */
								this.getLocations()
							} else if (res.authSetting['scope.userLocation'] === undefined) {
								uni.authorize({
									scope: 'scope.userLocation',
									success: function() {
										console.log('用户同意了授权')
									}
								})
							} else {
								uni.authorize({
									scope: 'scope.userLocation',
									success: function() {
										console.log('用户同意了授权')
									}
								})
							}
						},
					})
					setTimeout(() => {
						this.isClickable = true;
					}, 500);
				} else {
					uni.showToast({
						title: '操作太快了~',
						icon: 'none'
					});
				}
			},
			//获取精度维度
			getLocations() {
				uni.getLocation({
					speed: true,
					type: 'wgs84',
					success: (locationRes) => {
						this.latitude = locationRes.latitude
						this.longitude = locationRes.longitude
						var datass = wgs.wgs84Togcj02(this.longitude, this.latitude)
						this.handerChooseLocation(datass[1], datass[0])
					},
					fail: (err) => {
						// uni.$u.toast(err);
					}
				});
			},
			handerChooseLocation(latitude, longitude) {
				uni.chooseLocation({
					latitude: latitude || '',
					longitude: longitude || '',
					success: (res) => {
						this.latitude = res.latitude
						this.longitude = res.longitude
						this.currentLocation = res
						this.area = this.currentLocation.address + this.currentLocation.name
					},
					fail: function(err) {}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.farm {
		width: 100%;
		background-color: #F5F7FB;
		padding-top: 24rpx;

		.vlsit_view {
			width: 702rpx;
			border-radius: 20rpx;
			background: #FFFFFF;
			margin-left: 24rpx;
			padding-top: 20rpx;
			box-sizing: border-box;
			margin-bottom: 20rpx;

			.jichuxinxi {
				width: 168rpx;
				height: 52rpx;
			}

			.shujusdf {
				width: 702rpx;
				height: 96rpx;
				padding-left: 24rpx;
				box-sizing: border-box;
				border-width: 1rpx 0rpx 1rpx 0rpx;
				border-style: solid;
				border-color: #EBEEF5;
				margin-top: 20rpx;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;

				.touxiang {
					width: 210rpx;
					font-size: 30rpx;
					color: #08112C;

					text {
						font-size: 30rpx;
						color: #FF4D4F;
					}
				}

				.touxiangsd {
					width: 280rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;

					.avaterss{
						width: 410rpx;
						.avater {
							width: 72rpx;
							height: 72rpx;
							border-radius: 50%;
						}
					}
				}

				.xialsd {
					width: 40rpx;
					height: 40rpx;
					margin-right: 16rpx;
				}
			}
			
			.shujusdfss{
				width: 702rpx;
				height: 173rpx;
				padding-left: 24rpx;
				box-sizing: border-box;
				border-width: 0rpx 0rpx 1rpx 0rpx;
				border-style: solid;
				border-color: #EBEEF5;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				
				.touxiang {
					width: 210rpx;
					font-size: 30rpx;
					color: #08112C;
				
					text {
						font-size: 30rpx;
						color: #FF4D4F;
					}
				}
				
				.touxiangsd {
					width: 465rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
				
					.onpus {
						width: 360rpx;
						font-size: 30rpx;
						color: #7C849C;
					}
				
					.onpuss {
						width: 360rpx;
						font-size: 30rpx;
						color: #08112C;
					}
				}
				
				.touxiangssd {
					width: 460rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
				
					.xuansda {
						font-size: 30rpx;
						color: #7C849C;
					}
				
					.xuansdas {
						font-size: 30rpx;
						color: #08112C;
					}
				}
				
				.xialsd {
					width: 40rpx;
					height: 40rpx;
					margin-right: 16rpx;
				}
			}

			.shujusdfs {
				width: 702rpx;
				height: 96rpx;
				padding-left: 24rpx;
				box-sizing: border-box;
				border-width: 0rpx 0rpx 1rpx 0rpx;
				border-style: solid;
				border-color: #EBEEF5;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;

				.touxiang {
					width: 210rpx;
					font-size: 30rpx;
					color: #08112C;

					text {
						font-size: 30rpx;
						color: #FF4D4F;
					}
				}

				.touxiangsd {
					width: 465rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;

					.onpus {
						width: 360rpx;
						font-size: 30rpx;
						color: #7C849C;
					}

					.onpuss {
						width: 360rpx;
						font-size: 30rpx;
						color: #08112C;
					}
				}

				.touxiangssd {
					width: 460rpx;
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;

					.xuansda {
						font-size: 30rpx;
						color: #7C849C;
					}

					.xuansdas {
						font-size: 30rpx;
						color: #08112C;
					}
				}

				.xialsd {
					width: 40rpx;
					height: 40rpx;
					margin-right: 16rpx;
				}
			}
		}
	}

	.tipPopup_titless {
		width: 100%;
		height: 70rpx;
		border-radius: 32rpx 32rpx 0rpx 0rpx;
		background: #FFFFFF;
		text-align: center;
		padding-top: 30rpx;
		padding-bottom: 10rpx;
		font-weight: 600;
		font-size: 34rpx;
	}

	.yxch_flex {
		width: 100%;
		display: flex;
		flex-wrap: wrap;

	}

	.yix_view {
		width: 176rpx;
		height: 64rpx;
		border-radius: 12rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		background: #05CF67;
		font-size: 30rpx;
		color: #FFFFFF;
		margin-left: 10rpx;
		margin-top: 12rpx;
	}

	.yix_views {
		width: 176rpx;
		height: 64rpx;
		border-radius: 12rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		background: rgba(41, 87, 155, 0.05);
		font-size: 30rpx;
		color: #485A75;
		margin-left: 10rpx;
		margin-top: 12rpx;
	}

	.baiocuyn {
		width: 702rpx;
		height: 80rpx;
		border-radius: 40rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		background: #05CF67;
		margin-left: 24rpx;
		margin-top: 80rpx;
		font-size: 30rpx;
		font-weight: 500;
		color: #FFFFFF;
	}

	.good_detil_navigationBar {
		width: 750rpx;
		height: 140rpx;
		opacity: 1;
		background: #fff;
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
		position: fixed;
		bottom: 0;
		z-index: 99;

		.cgouimai {
			width: 702rpx;
			height: 80rpx;
			border-radius: 40rpx;
			display: flex;
			flex-direction: row;
			justify-content: center;
			align-items: center;
			background: #05CF67;
			box-sizing: border-box;
			border: 1rpx solid #05CF67;
			font-size: 30rpx;
			font-weight: 500;
			color: #FFFFFF;
			margin-left: 24rpx;
			margin-bottom: 25rpx;
		}
	}
	.asosafasdf{
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
		align-items: center;
	}
	.imfgaf{
		font-size: 28rpx;
		color: #08112C;
		margin-right: 26rpx;
	}
</style>